Special Character Must Be Replaced
From Documentation
This documentation is for an older version of ZK. For the latest one, please click here.
XML use <element-name>
to denote an element, so you have to replace special characters. For example, you have to use <
to represent the <
character.
Required only if use it in a XML attribute's value | ||
Required only if use it in a XML attribute's value |
Alternatively, you could tell XML parser not to interpret a piece of text by using CDATA
as the following.
<zscript>
<![CDATA[
void myfunc(int a, int b) {
if (a < 0 && b > 0) {
//do something
}
]]>
</zscript>
It is suggested to always add <![CDATA[ ]]>
inside your <zscript> </zscript>
. Thus you don't have to worry about escape sequences for special characters like "&", "<". In addition, the code is much easier to read and maintain.